<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>GSubprocess: GIO Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GIO Reference Manual">
<link rel="up" href="subprocesses.html" title="Subprocesses">
<link rel="prev" href="subprocesses.html" title="Subprocesses">
<link rel="next" href="GSubprocessLauncher.html" title="GSubprocess Launcher">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#GSubprocess.description" class="shortcut">Description</a></span><span id="nav_hierarchy">  <span class="dim">|</span> 
                  <a href="#GSubprocess.object-hierarchy" class="shortcut">Object Hierarchy</a></span><span id="nav_interfaces">  <span class="dim">|</span> 
                  <a href="#GSubprocess.implemented-interfaces" class="shortcut">Implemented Interfaces</a></span><span id="nav_properties">  <span class="dim">|</span> 
                  <a href="#GSubprocess.properties" class="shortcut">Properties</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="subprocesses.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="subprocesses.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="GSubprocessLauncher.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="GSubprocess"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="GSubprocess.top_of_page"></a>GSubprocess</span></h2>
<p>GSubprocess — Child processes</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="GSubprocess.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<a class="link" href="GSubprocess.html" title="GSubprocess"><span class="returnvalue">GSubprocess</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-new" title="g_subprocess_new ()">g_subprocess_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GSubprocess.html" title="GSubprocess"><span class="returnvalue">GSubprocess</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-newv" title="g_subprocess_newv ()">g_subprocess_newv</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-identifier" title="g_subprocess_get_identifier ()">g_subprocess_get_identifier</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-stdin-pipe" title="g_subprocess_get_stdin_pipe ()">g_subprocess_get_stdin_pipe</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-stdout-pipe" title="g_subprocess_get_stdout_pipe ()">g_subprocess_get_stdout_pipe</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-stderr-pipe" title="g_subprocess_get_stderr_pipe ()">g_subprocess_get_stderr_pipe</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()">g_subprocess_wait</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait-async" title="g_subprocess_wait_async ()">g_subprocess_wait_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait-finish" title="g_subprocess_wait_finish ()">g_subprocess_wait_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait-check" title="g_subprocess_wait_check ()">g_subprocess_wait_check</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait-check-async" title="g_subprocess_wait_check_async ()">g_subprocess_wait_check_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-wait-check-finish" title="g_subprocess_wait_check_finish ()">g_subprocess_wait_check_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-successful" title="g_subprocess_get_successful ()">g_subprocess_get_successful</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()">g_subprocess_get_if_exited</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-exit-status" title="g_subprocess_get_exit_status ()">g_subprocess_get_exit_status</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-if-signaled" title="g_subprocess_get_if_signaled ()">g_subprocess_get_if_signaled</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-term-sig" title="g_subprocess_get_term_sig ()">g_subprocess_get_term_sig</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-get-status" title="g_subprocess_get_status ()">g_subprocess_get_status</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-send-signal" title="g_subprocess_send_signal ()">g_subprocess_send_signal</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-force-exit" title="g_subprocess_force_exit ()">g_subprocess_force_exit</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate" title="g_subprocess_communicate ()">g_subprocess_communicate</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate-async" title="g_subprocess_communicate_async ()">g_subprocess_communicate_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate-finish" title="g_subprocess_communicate_finish ()">g_subprocess_communicate_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8" title="g_subprocess_communicate_utf8 ()">g_subprocess_communicate_utf8</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8-async" title="g_subprocess_communicate_utf8_async ()">g_subprocess_communicate_utf8_async</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8-finish" title="g_subprocess_communicate_utf8_finish ()">g_subprocess_communicate_utf8_finish</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSubprocess.properties"></a><h2>Properties</h2>
<div class="informaltable"><table class="informaltable" border="0">
<colgroup>
<col width="150px" class="properties_type">
<col width="300px" class="properties_name">
<col width="200px" class="properties_flags">
</colgroup>
<tbody>
<tr>
<td class="property_type"><a href="../glib-String-Utility-Functions.html#GStrv"><span class="type">GStrv</span></a></td>
<td class="property_name"><a class="link" href="GSubprocess.html#GSubprocess--argv" title="The “argv” property">argv</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr>
<tr>
<td class="property_type"><a class="link" href="GSubprocess.html#GSubprocessFlags" title="enum GSubprocessFlags"><span class="type">GSubprocessFlags</span></a></td>
<td class="property_name"><a class="link" href="GSubprocess.html#GSubprocess--flags" title="The “flags” property">flags</a></td>
<td class="property_flags">Write / Construct Only</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSubprocess.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="GSubprocess.html#GSubprocess-struct" title="GSubprocess">GSubprocess</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="GSubprocess.html#GSubprocessFlags" title="enum GSubprocessFlags">GSubprocessFlags</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="GSubprocess.object-hierarchy"></a><h2>Object Hierarchy</h2>
<pre class="screen">    <a href="../gobject-The-Base-Object-Type.html#GObject-struct">GObject</a>
    <span class="lineart">╰──</span> GSubprocess
</pre>
</div>
<div class="refsect1">
<a name="GSubprocess.implemented-interfaces"></a><h2>Implemented Interfaces</h2>
<p>
GSubprocess implements
 <a class="link" href="GInitable.html" title="GInitable">GInitable</a>.</p>
</div>
<div class="refsect1">
<a name="GSubprocess.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;gio/gio.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="GSubprocess.description"></a><h2>Description</h2>
<p><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> allows the creation of and interaction with child
processes.</p>
<p>Processes can be communicated with using standard GIO-style APIs (ie:
<a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a>, <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a>).  There are GIO-style APIs to wait for
process termination (ie: cancellable and with an asynchronous
variant).</p>
<p>There is an API to force a process to terminate, as well as a
race-free API for sending UNIX signals to a subprocess.</p>
<p>One major advantage that GIO brings over the core GLib library is
comprehensive API for asynchronous I/O, such
<a class="link" href="GOutputStream.html#g-output-stream-splice-async" title="g_output_stream_splice_async ()"><code class="function">g_output_stream_splice_async()</code></a>.  This makes GSubprocess
significantly more powerful and flexible than equivalent APIs in
some other languages such as the <code class="literal">subprocess.py</code>
included with Python.  For example, using <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> one could
create two child processes, reading standard output from the first,
processing it, and writing to the input stream of the second, all
without blocking the main loop.</p>
<p>A powerful <a class="link" href="GSubprocess.html#g-subprocess-communicate" title="g_subprocess_communicate ()"><code class="function">g_subprocess_communicate()</code></a> API is provided similar to the
<code class="literal"><code class="function">communicate()</code></code> method of <code class="literal">subprocess.py</code>. This enables very easy
interaction with a subprocess that has been opened with pipes.</p>
<p><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> defaults to tight control over the file descriptors open
in the child process, avoiding dangling-fd issues that are caused by
a simple <code class="function">fork()</code>/<code class="function">exec()</code>.  The only open file descriptors in the
spawned process are ones that were explicitly specified by the
<a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> API (unless <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-INHERIT-FDS:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_INHERIT_FDS</code></a> was
specified).</p>
<p><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> will quickly reap all child processes as they exit,
avoiding "zombie processes" remaining around for long periods of
time.  <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> can be used to wait for this to happen,
but it will happen even without the call being explicitly made.</p>
<p>As a matter of principle, <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> has no API that accepts
shell-style space-separated strings.  It will, however, match the
typical shell behaviour of searching the PATH for executables that do
not contain a directory separator in their name.</p>
<p><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> attempts to have a very simple API for most uses (ie:
spawning a subprocess with arguments and support for most typical
kinds of input and output redirection).  See <a class="link" href="GSubprocess.html#g-subprocess-new" title="g_subprocess_new ()"><code class="function">g_subprocess_new()</code></a>. The
<a class="link" href="GSubprocessLauncher.html" title="GSubprocess Launcher"><span class="type">GSubprocessLauncher</span></a> API is provided for more complicated cases
(advanced types of redirection, environment variable manipulation,
change of working directory, child setup functions, etc).</p>
<p>A typical use of <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> will involve calling
<a class="link" href="GSubprocess.html#g-subprocess-new" title="g_subprocess_new ()"><code class="function">g_subprocess_new()</code></a>, followed by <a class="link" href="GSubprocess.html#g-subprocess-wait-async" title="g_subprocess_wait_async ()"><code class="function">g_subprocess_wait_async()</code></a> or
<a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a>.  After the process exits, the status can be
checked using functions such as <a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()"><code class="function">g_subprocess_get_if_exited()</code></a> (which
are similar to the familiar WIFEXITED-style POSIX macros).</p>
</div>
<div class="refsect1">
<a name="GSubprocess.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-subprocess-new"></a><h3>g_subprocess_new ()</h3>
<pre class="programlisting"><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="returnvalue">GSubprocess</span></a> *
g_subprocess_new (<em class="parameter"><code><a class="link" href="GSubprocess.html#GSubprocessFlags" title="enum GSubprocessFlags"><span class="type">GSubprocessFlags</span></a> flags</code></em>,
                  <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>,
                  <em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> *argv0</code></em>,
                  <em class="parameter"><code>...</code></em>);</pre>
<p>Create a new process with the given flags and varargs argument
list.  By default, matching the <a href="../glib-Spawning-Processes.html#g-spawn-async"><code class="function">g_spawn_async()</code></a> defaults, the
child's stdin will be set to the system null device, and
stdout/stderr will be inherited from the parent.  You can use
<em class="parameter"><code>flags</code></em>
 to control this behavior.</p>
<p>The argument list must be terminated with <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
<p><span class="annotation">[<acronym title="Exposed in C code, not necessarily available in other languages."><span class="acronym">skip</span></acronym>]</span></p>
<div class="refsect3">
<a name="g-subprocess-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>flags that define the behaviour of the subprocess</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for an error, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>argv0</p></td>
<td class="parameter_description"><p>first commandline argument to pass to the subprocess</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>...</p></td>
<td class="parameter_description"><p>more commandline arguments, followed by <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-new.returns"></a><h4>Returns</h4>
<p> A newly created <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error (and <em class="parameter"><code>error</code></em>
will be set)</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-newv"></a><h3>g_subprocess_newv ()</h3>
<pre class="programlisting"><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="returnvalue">GSubprocess</span></a> *
g_subprocess_newv (<em class="parameter"><code>const <a href="../glib-Basic-Types.html#gchar"><span class="type">gchar</span></a> * const *argv</code></em>,
                   <em class="parameter"><code><a class="link" href="GSubprocess.html#GSubprocessFlags" title="enum GSubprocessFlags"><span class="type">GSubprocessFlags</span></a> flags</code></em>,
                   <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Create a new process with the given flags and argument list.</p>
<p>The argument list is expected to be <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>-terminated.</p>
<p><span class="annotation">[<acronym title="Rename the original symbol's name to SYMBOL."><span class="acronym">rename-to</span></acronym> g_subprocess_new]</span></p>
<div class="refsect3">
<a name="g-subprocess-newv.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>argv</p></td>
<td class="parameter_description"><p> commandline arguments for the subprocess. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter points to an array of items."><span class="acronym">array</span></acronym> zero-terminated=1][<acronym title="Generics and defining elements of containers and arrays."><span class="acronym">element-type</span></acronym> utf8]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>flags</p></td>
<td class="parameter_description"><p>flags that define the behaviour of the subprocess</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p> return location for an error, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-newv.returns"></a><h4>Returns</h4>
<p> A newly created <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> on error (and <em class="parameter"><code>error</code></em>
will be set)</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-identifier"></a><h3>g_subprocess_get_identifier ()</h3>
<pre class="programlisting">const <a href="../glib-Basic-Types.html#gchar"><span class="returnvalue">gchar</span></a> *
g_subprocess_get_identifier (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>On UNIX, returns the process ID as a decimal string.
On Windows, returns the result of <code class="function">GetProcessId()</code> also as a string.</p>
<div class="refsect3">
<a name="g-subprocess-get-identifier.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-stdin-pipe"></a><h3>g_subprocess_get_stdin_pipe ()</h3>
<pre class="programlisting"><a class="link" href="GOutputStream.html" title="GOutputStream"><span class="returnvalue">GOutputStream</span></a> *
g_subprocess_get_stdin_pipe (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Gets the <a class="link" href="GOutputStream.html" title="GOutputStream"><span class="type">GOutputStream</span></a> that you can write to in order to give data
to the stdin of <em class="parameter"><code>subprocess</code></em>
.</p>
<p>The process must have been created with
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDIN-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDIN_PIPE</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-get-stdin-pipe.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-stdin-pipe.returns"></a><h4>Returns</h4>
<p> the stdout pipe. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-stdout-pipe"></a><h3>g_subprocess_get_stdout_pipe ()</h3>
<pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
g_subprocess_get_stdout_pipe (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Gets the <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> from which to read the stdout output of
<em class="parameter"><code>subprocess</code></em>
.</p>
<p>The process must have been created with
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-get-stdout-pipe.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-stdout-pipe.returns"></a><h4>Returns</h4>
<p> the stdout pipe. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-stderr-pipe"></a><h3>g_subprocess_get_stderr_pipe ()</h3>
<pre class="programlisting"><a class="link" href="GInputStream.html" title="GInputStream"><span class="returnvalue">GInputStream</span></a> *
g_subprocess_get_stderr_pipe (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Gets the <a class="link" href="GInputStream.html" title="GInputStream"><span class="type">GInputStream</span></a> from which to read the stderr output of
<em class="parameter"><code>subprocess</code></em>
.</p>
<p>The process must have been created with
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDERR-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDERR_PIPE</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-get-stderr-pipe.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-stderr-pipe.returns"></a><h4>Returns</h4>
<p> the stderr pipe. </p>
<p><span class="annotation">[<acronym title="Don't free data after the code is done."><span class="acronym">transfer none</span></acronym>]</span></p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait"></a><h3>g_subprocess_wait ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_wait (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                   <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                   <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Synchronously wait for the subprocess to terminate.</p>
<p>After the process terminates you can query its exit status with
functions such as <a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()"><code class="function">g_subprocess_get_if_exited()</code></a> and
<a class="link" href="GSubprocess.html#g-subprocess-get-exit-status" title="g_subprocess_get_exit_status ()"><code class="function">g_subprocess_get_exit_status()</code></a>.</p>
<p>This function does not fail in the case of the subprocess having
abnormal termination.  See <a class="link" href="GSubprocess.html#g-subprocess-wait-check" title="g_subprocess_wait_check ()"><code class="function">g_subprocess_wait_check()</code></a> for that.</p>
<p>Cancelling <em class="parameter"><code>cancellable</code></em>
 doesn't kill the subprocess.  Call
<a class="link" href="GSubprocess.html#g-subprocess-force-exit" title="g_subprocess_force_exit ()"><code class="function">g_subprocess_force_exit()</code></a> if it is desirable.</p>
<div class="refsect3">
<a name="g-subprocess-wait.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-wait.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if <em class="parameter"><code>cancellable</code></em>
was cancelled</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait-async"></a><h3>g_subprocess_wait_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_wait_async (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                         <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                         <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Wait for the subprocess to terminate.</p>
<p>This is the asynchronous version of <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-wait-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the operation is complete</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user_data for <em class="parameter"><code>callback</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait-finish"></a><h3>g_subprocess_wait_finish ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_wait_finish (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                          <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                          <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Collects the result of a previous call to
<a class="link" href="GSubprocess.html#g-subprocess-wait-async" title="g_subprocess_wait_async ()"><code class="function">g_subprocess_wait_async()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-wait-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>the <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> passed to your <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a pointer to a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-wait-finish.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful, or <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> with <em class="parameter"><code>error</code></em>
set</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait-check"></a><h3>g_subprocess_wait_check ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_wait_check (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                         <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                         <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Combines <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> with <a href="../glib-Spawning-Processes.html#g-spawn-check-exit-status"><code class="function">g_spawn_check_exit_status()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-wait-check.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-wait-check.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> on success, <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> if process exited abnormally, or
<em class="parameter"><code>cancellable</code></em>
was cancelled</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait-check-async"></a><h3>g_subprocess_wait_check_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_wait_check_async (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                               <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                               <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                               <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Combines <a class="link" href="GSubprocess.html#g-subprocess-wait-async" title="g_subprocess_wait_async ()"><code class="function">g_subprocess_wait_async()</code></a> with <a href="../glib-Spawning-Processes.html#g-spawn-check-exit-status"><code class="function">g_spawn_check_exit_status()</code></a>.</p>
<p>This is the asynchronous version of <a class="link" href="GSubprocess.html#g-subprocess-wait-check" title="g_subprocess_wait_check ()"><code class="function">g_subprocess_wait_check()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-wait-check-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>a <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> to call when the operation is complete</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>user_data for <em class="parameter"><code>callback</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-wait-check-finish"></a><h3>g_subprocess_wait_check_finish ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_wait_check_finish (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                                <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Collects the result of a previous call to
<a class="link" href="GSubprocess.html#g-subprocess-wait-check-async" title="g_subprocess_wait_check_async ()"><code class="function">g_subprocess_wait_check_async()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-wait-check-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>the <a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> passed to your <a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a pointer to a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a>, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-wait-check-finish.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful, or <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> with <em class="parameter"><code>error</code></em>
set</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-successful"></a><h3>g_subprocess_get_successful ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_get_successful (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Checks if the process was "successful".  A process is considered
successful if it exited cleanly with an exit status of 0, either by
way of the <code class="function">exit()</code> system call or return from <code class="function">main()</code>.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> has
returned.</p>
<div class="refsect3">
<a name="g-subprocess-get-successful.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-successful.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the process exited cleanly with a exit status of 0</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-if-exited"></a><h3>g_subprocess_get_if_exited ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_get_if_exited (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Check if the given subprocess exited normally (ie: by way of <code class="function">exit()</code>
or return from <code class="function">main()</code>).</p>
<p>This is equivalent to the system WIFEXITED macro.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> has
returned.</p>
<div class="refsect3">
<a name="g-subprocess-get-if-exited.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-if-exited.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the case of a normal exit</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-exit-status"></a><h3>g_subprocess_get_exit_status ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
g_subprocess_get_exit_status (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Check the exit status of the subprocess, given that it exited
normally.  This is the value passed to the <code class="function">exit()</code> system call or the
return value from main.</p>
<p>This is equivalent to the system WEXITSTATUS macro.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> and
unless <a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()"><code class="function">g_subprocess_get_if_exited()</code></a> returned <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-get-exit-status.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-exit-status.returns"></a><h4>Returns</h4>
<p> the exit status</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-if-signaled"></a><h3>g_subprocess_get_if_signaled ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_get_if_signaled (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Check if the given subprocess terminated in response to a signal.</p>
<p>This is equivalent to the system WIFSIGNALED macro.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> has
returned.</p>
<div class="refsect3">
<a name="g-subprocess-get-if-signaled.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-if-signaled.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if the case of termination due to a signal</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-term-sig"></a><h3>g_subprocess_get_term_sig ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
g_subprocess_get_term_sig (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Get the signal number that caused the subprocess to terminate, given
that it terminated due to a signal.</p>
<p>This is equivalent to the system WTERMSIG macro.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> and
unless <a class="link" href="GSubprocess.html#g-subprocess-get-if-signaled" title="g_subprocess_get_if_signaled ()"><code class="function">g_subprocess_get_if_signaled()</code></a> returned <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-get-term-sig.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-term-sig.returns"></a><h4>Returns</h4>
<p> the signal causing termination</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-get-status"></a><h3>g_subprocess_get_status ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gint"><span class="returnvalue">gint</span></a>
g_subprocess_get_status (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Gets the raw status code of the process, as from <code class="function">waitpid()</code>.</p>
<p>This value has no particular meaning, but it can be used with the
macros defined by the system headers such as WIFEXITED.  It can also
be used with <a href="../glib-Spawning-Processes.html#g-spawn-check-exit-status"><code class="function">g_spawn_check_exit_status()</code></a>.</p>
<p>It is more likely that you want to use <a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()"><code class="function">g_subprocess_get_if_exited()</code></a>
followed by <a class="link" href="GSubprocess.html#g-subprocess-get-exit-status" title="g_subprocess_get_exit_status ()"><code class="function">g_subprocess_get_exit_status()</code></a>.</p>
<p>It is an error to call this function before <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> has
returned.</p>
<div class="refsect3">
<a name="g-subprocess-get-status.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-get-status.returns"></a><h4>Returns</h4>
<p> the (meaningless) <code class="function">waitpid()</code> exit status from the kernel</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-send-signal"></a><h3>g_subprocess_send_signal ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_send_signal (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                          <em class="parameter"><code><a href="../glib-Basic-Types.html#gint"><span class="type">gint</span></a> signal_num</code></em>);</pre>
<p>Sends the UNIX signal <em class="parameter"><code>signal_num</code></em>
 to the subprocess, if it is still
running.</p>
<p>This API is race-free.  If the subprocess has terminated, it will not
be signalled.</p>
<p>This API is not available on Windows.</p>
<div class="refsect3">
<a name="g-subprocess-send-signal.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>signal_num</p></td>
<td class="parameter_description"><p>the signal number to send</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-force-exit"></a><h3>g_subprocess_force_exit ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_force_exit (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>);</pre>
<p>Use an operating-system specific method to attempt an immediate,
forceful termination of the process.  There is no mechanism to
determine whether or not the request itself was successful;
however, you can use <a class="link" href="GSubprocess.html#g-subprocess-wait" title="g_subprocess_wait ()"><code class="function">g_subprocess_wait()</code></a> to monitor the status of
the process after calling this function.</p>
<p>On Unix, this function sends <code class="literal">SIGKILL</code>.</p>
<div class="refsect3">
<a name="g-subprocess-force-exit.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate"></a><h3>g_subprocess_communicate ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_communicate (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                          <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *stdin_buf</code></em>,
                          <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                          <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> **stdout_buf</code></em>,
                          <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> **stderr_buf</code></em>,
                          <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Communicate with the subprocess until it terminates, and all input
and output has been completed.</p>
<p>If <em class="parameter"><code>stdin_buf</code></em>
 is given, the subprocess must have been created with
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDIN-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDIN_PIPE</code></a>.  The given data is fed to the
stdin of the subprocess and the pipe is closed (ie: EOF).</p>
<p>At the same time (as not to cause blocking when dealing with large
amounts of data), if <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a> or
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDERR-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDERR_PIPE</code></a> were used, reads from those
streams.  The data that was read is returned in <em class="parameter"><code>stdout</code></em>
 and/or
the <em class="parameter"><code>stderr</code></em>
.</p>
<p>If the subprocess was created with <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a>,
<em class="parameter"><code>stdout_buf</code></em>
 will contain the data read from stdout.  Otherwise, for
subprocesses not created with <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a>,
<em class="parameter"><code>stdout_buf</code></em>
 will be set to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.  Similar provisions apply to
<em class="parameter"><code>stderr_buf</code></em>
 and <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDERR-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDERR_PIPE</code></a>.</p>
<p>As usual, any output variable may be given as <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> to ignore it.</p>
<p>If you desire the stdout and stderr data to be interleaved, create
the subprocess with <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a> and
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDERR-MERGE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDERR_MERGE</code></a>.  The merged result will be returned
in <em class="parameter"><code>stdout_buf</code></em>
 and <em class="parameter"><code>stderr_buf</code></em>
 will be set to <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>.</p>
<p>In case of any error (including cancellation), <a href="../glib-Standard-Macros.html#FALSE:CAPS"><code class="literal">FALSE</code></a> will be
returned with <em class="parameter"><code>error</code></em>
 set.  Some or all of the stdin data may have
been written.  Any stdout or stderr data that has been read will be
discarded. None of the out variables (aside from <em class="parameter"><code>error</code></em>
) will have
been set to anything in particular and should not be inspected.</p>
<p>In the case that <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> is returned, the subprocess has exited and the
exit status inspection APIs (eg: <a class="link" href="GSubprocess.html#g-subprocess-get-if-exited" title="g_subprocess_get_if_exited ()"><code class="function">g_subprocess_get_if_exited()</code></a>,
<a class="link" href="GSubprocess.html#g-subprocess-get-exit-status" title="g_subprocess_get_exit_status ()"><code class="function">g_subprocess_get_exit_status()</code></a>) may be used.</p>
<p>You should not attempt to use any of the subprocess pipes after
starting this function, since they may be left in strange states,
even if the operation was cancelled.  You should especially not
attempt to interact with the pipes while the operation is in progress
(either from another thread or if using the asynchronous version).</p>
<div class="refsect3">
<a name="g-subprocess-communicate.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdin_buf</p></td>
<td class="parameter_description"><p> data to send to the stdin of the subprocess, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdout_buf</p></td>
<td class="parameter_description"><p> data read from the subprocess stdout. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>stderr_buf</p></td>
<td class="parameter_description"><p> data read from the subprocess stderr. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a pointer to a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-subprocess-communicate.returns"></a><h4>Returns</h4>
<p> <a href="../glib-Standard-Macros.html#TRUE:CAPS"><code class="literal">TRUE</code></a> if successful</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate-async"></a><h3>g_subprocess_communicate_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_communicate_async (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                                <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> *stdin_buf</code></em>,
                                <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Asynchronous version of <a class="link" href="GSubprocess.html#g-subprocess-communicate" title="g_subprocess_communicate ()"><code class="function">g_subprocess_communicate()</code></a>.  Complete
invocation with <a class="link" href="GSubprocess.html#g-subprocess-communicate-finish" title="g_subprocess_communicate_finish ()"><code class="function">g_subprocess_communicate_finish()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-communicate-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>Self</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdin_buf</p></td>
<td class="parameter_description"><p> Input data, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p> Cancellable. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>Callback</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>User data</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate-finish"></a><h3>g_subprocess_communicate_finish ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_communicate_finish (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                                 <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                 <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> **stdout_buf</code></em>,
                                 <em class="parameter"><code><a href="../glib-Byte-Arrays.html#GBytes"><span class="type">GBytes</span></a> **stderr_buf</code></em>,
                                 <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Complete an invocation of <a class="link" href="GSubprocess.html#g-subprocess-communicate-async" title="g_subprocess_communicate_async ()"><code class="function">g_subprocess_communicate_async()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-communicate-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>Self</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Result</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdout_buf</p></td>
<td class="parameter_description"><p> Return location for stdout data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>stderr_buf</p></td>
<td class="parameter_description"><p> Return location for stderr data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Error</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate-utf8"></a><h3>g_subprocess_communicate_utf8 ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_communicate_utf8 (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                               <em class="parameter"><code>const <span class="type">char</span> *stdin_buf</code></em>,
                               <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                               <em class="parameter"><code><span class="type">char</span> **stdout_buf</code></em>,
                               <em class="parameter"><code><span class="type">char</span> **stderr_buf</code></em>,
                               <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Like <a class="link" href="GSubprocess.html#g-subprocess-communicate" title="g_subprocess_communicate ()"><code class="function">g_subprocess_communicate()</code></a>, but validates the output of the
process as UTF-8, and returns it as a regular NUL terminated string.</p>
<div class="refsect3">
<a name="g-subprocess-communicate-utf8.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdin_buf</p></td>
<td class="parameter_description"><p> data to send to the stdin of the subprocess, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>a <a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdout_buf</p></td>
<td class="parameter_description"><p> data read from the subprocess stdout. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>stderr_buf</p></td>
<td class="parameter_description"><p> data read from the subprocess stderr. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>a pointer to a <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a> <a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> pointer, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate-utf8-async"></a><h3>g_subprocess_communicate_utf8_async ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_subprocess_communicate_utf8_async (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                                     <em class="parameter"><code>const <span class="type">char</span> *stdin_buf</code></em>,
                                     <em class="parameter"><code><a class="link" href="GCancellable.html" title="GCancellable"><span class="type">GCancellable</span></a> *cancellable</code></em>,
                                     <em class="parameter"><code><a class="link" href="GAsyncResult.html#GAsyncReadyCallback" title="GAsyncReadyCallback ()"><span class="type">GAsyncReadyCallback</span></a> callback</code></em>,
                                     <em class="parameter"><code><a href="../glib-Basic-Types.html#gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<p>Asynchronous version of <a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8" title="g_subprocess_communicate_utf8 ()"><code class="function">g_subprocess_communicate_utf8()</code></a>.  Complete
invocation with <a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8-finish" title="g_subprocess_communicate_utf8_finish ()"><code class="function">g_subprocess_communicate_utf8_finish()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-communicate-utf8-async.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>Self</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdin_buf</p></td>
<td class="parameter_description"><p> Input data, or <a href="../glib-Standard-Macros.html#NULL:CAPS"><code class="literal">NULL</code></a>. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="NULL is OK, both for passing and for returning."><span class="acronym">allow-none</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>cancellable</p></td>
<td class="parameter_description"><p>Cancellable</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>callback</p></td>
<td class="parameter_description"><p>Callback</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>User data</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-subprocess-communicate-utf8-finish"></a><h3>g_subprocess_communicate_utf8_finish ()</h3>
<pre class="programlisting"><a href="../glib-Basic-Types.html#gboolean"><span class="returnvalue">gboolean</span></a>
g_subprocess_communicate_utf8_finish (<em class="parameter"><code><a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a> *subprocess</code></em>,
                                      <em class="parameter"><code><a class="link" href="GAsyncResult.html" title="GAsyncResult"><span class="type">GAsyncResult</span></a> *result</code></em>,
                                      <em class="parameter"><code><span class="type">char</span> **stdout_buf</code></em>,
                                      <em class="parameter"><code><span class="type">char</span> **stderr_buf</code></em>,
                                      <em class="parameter"><code><a href="../glib-Error-Reporting.html#GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<p>Complete an invocation of <a class="link" href="GSubprocess.html#g-subprocess-communicate-utf8-async" title="g_subprocess_communicate_utf8_async ()"><code class="function">g_subprocess_communicate_utf8_async()</code></a>.</p>
<div class="refsect3">
<a name="g-subprocess-communicate-utf8-finish.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>subprocess</p></td>
<td class="parameter_description"><p>Self</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>result</p></td>
<td class="parameter_description"><p>Result</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stdout_buf</p></td>
<td class="parameter_description"><p> Return location for stdout data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>stderr_buf</p></td>
<td class="parameter_description"><p> Return location for stderr data. </p></td>
<td class="parameter_annotations"><span class="annotation">[<acronym title="Parameter for returning results. Default is transfer full."><span class="acronym">out</span></acronym>]</span></td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>Error</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="GSubprocess.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="GSubprocess-struct"></a><h3>GSubprocess</h3>
<pre class="programlisting">typedef struct _GSubprocess GSubprocess;</pre>
<p>A child process.</p>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
<hr>
<div class="refsect2">
<a name="GSubprocessFlags"></a><h3>enum GSubprocessFlags</h3>
<p>Flags to define the behaviour of a <a class="link" href="GSubprocess.html" title="GSubprocess"><span class="type">GSubprocess</span></a>.</p>
<p>Note that the default for stdin is to redirect from /dev/null.  For
stdout and stderr the default are for them to inherit the
corresponding descriptor from the calling process.</p>
<p>Note that it is a programmer error to mix 'incompatible' flags.  For
example, you may not request both <a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_PIPE</code></a> and
<a class="link" href="GSubprocess.html#G-SUBPROCESS-FLAGS-STDOUT-SILENCE:CAPS"><code class="literal">G_SUBPROCESS_FLAGS_STDOUT_SILENCE</code></a>.</p>
<div class="refsect3">
<a name="GSubprocessFlags.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-NONE:CAPS"></a>G_SUBPROCESS_FLAGS_NONE</p></td>
<td class="enum_member_description">
<p>No flags.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDIN-PIPE:CAPS"></a>G_SUBPROCESS_FLAGS_STDIN_PIPE</p></td>
<td class="enum_member_description">
<p>create a pipe for the stdin of the
  spawned process that can be accessed with
  <a class="link" href="GSubprocess.html#g-subprocess-get-stdin-pipe" title="g_subprocess_get_stdin_pipe ()"><code class="function">g_subprocess_get_stdin_pipe()</code></a>.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDIN-INHERIT:CAPS"></a>G_SUBPROCESS_FLAGS_STDIN_INHERIT</p></td>
<td class="enum_member_description">
<p>stdin is inherited from the
  calling process.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDOUT-PIPE:CAPS"></a>G_SUBPROCESS_FLAGS_STDOUT_PIPE</p></td>
<td class="enum_member_description">
<p>create a pipe for the stdout of the
  spawned process that can be accessed with
  <a class="link" href="GSubprocess.html#g-subprocess-get-stdout-pipe" title="g_subprocess_get_stdout_pipe ()"><code class="function">g_subprocess_get_stdout_pipe()</code></a>.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDOUT-SILENCE:CAPS"></a>G_SUBPROCESS_FLAGS_STDOUT_SILENCE</p></td>
<td class="enum_member_description">
<p>silence the stdout of the spawned
  process (ie: redirect to /dev/null).</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDERR-PIPE:CAPS"></a>G_SUBPROCESS_FLAGS_STDERR_PIPE</p></td>
<td class="enum_member_description">
<p>create a pipe for the stderr of the
  spawned process that can be accessed with
  <a class="link" href="GSubprocess.html#g-subprocess-get-stderr-pipe" title="g_subprocess_get_stderr_pipe ()"><code class="function">g_subprocess_get_stderr_pipe()</code></a>.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDERR-SILENCE:CAPS"></a>G_SUBPROCESS_FLAGS_STDERR_SILENCE</p></td>
<td class="enum_member_description">
<p>silence the stderr of the spawned
  process (ie: redirect to /dev/null).</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-STDERR-MERGE:CAPS"></a>G_SUBPROCESS_FLAGS_STDERR_MERGE</p></td>
<td class="enum_member_description">
<p>merge the stderr of the spawned
  process with whatever the stdout happens to be.  This is a good way
  of directing both streams to a common log file, for example.</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-SUBPROCESS-FLAGS-INHERIT-FDS:CAPS"></a>G_SUBPROCESS_FLAGS_INHERIT_FDS</p></td>
<td class="enum_member_description">
<p>spawned processes will inherit the
  file descriptors of their parent, unless those descriptors have
  been explicitly marked as close-on-exec.  This flag has no effect
  over the "standard" file descriptors (stdin, stdout, stderr).</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-40.html#api-index-2.40">2.40</a></p>
</div>
</div>
<div class="refsect1">
<a name="GSubprocess.property-details"></a><h2>Property Details</h2>
<div class="refsect2">
<a name="GSubprocess--argv"></a><h3>The <code class="literal">“argv”</code> property</h3>
<pre class="programlisting">  “argv”                     <a href="../glib-String-Utility-Functions.html#GStrv"><span class="type">GStrv</span></a></pre>
<p>Argument vector.</p>
<p>Flags: Write / Construct Only</p>
</div>
<hr>
<div class="refsect2">
<a name="GSubprocess--flags"></a><h3>The <code class="literal">“flags”</code> property</h3>
<pre class="programlisting">  “flags”                    <a class="link" href="GSubprocess.html#GSubprocessFlags" title="enum GSubprocessFlags"><span class="type">GSubprocessFlags</span></a></pre>
<p>Subprocess flags.</p>
<p>Flags: Write / Construct Only</p>
</div>
</div>
<div class="refsect1">
<a name="GSubprocess.see-also"></a><h2>See Also</h2>
<p><a class="link" href="GSubprocessLauncher.html" title="GSubprocess Launcher"><span class="type">GSubprocessLauncher</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>